<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* .nav a {
            color: #333;
            text-decoration: none;
        } */
        .nav .router-link-exact-active {
            color: blue;
        }
    </style>
</head>
<body>
    <div id="app">
        <div class="nav">
            <router-link tag="span" to="/lol/123">英雄联盟</router-link>
            <router-link tag="span" to="/pubg/234">绝地求生</router-link>
            <router-link to="/wzry/0">王者荣耀</router-link>
            <router-link to="/dnf/1">dnf</router-link>
        </div>
        
        <router-view></router-view>
    </div>
    <script src="../js/vue.js"></script>
    <script src="../js/vue-router.js"></script>
    <script>
        const page2 = {
            template: `<div>这是{{$route.params.path}}</div>`
        }
        const router = new VueRouter({
            // 动态路由就是在路由地址后面用一个：自定义变量的方式
            // 这个变量会成为params参数中的key
            routes: [
                {
                    path: '/:path/:id',
                    name: 'Lol',
                    component: page2
                }
            ]
        })


        new Vue({
            router
        }).$mount('#app')
    </script>
</body>
</html>